<!DOCTYPE html>
<html class="bg-white">
<head>
	<include file="Public:common-css" />
	<link type="text/css" rel="stylesheet" href="__ICSS__/member.css" />
</head>
<body>
	<div class="member-order-refund">
		<input type="hidden" value="<{$data.code}>" class="order-id"/>
		<div class="member-order-refund-item">
			<span>退款金额：</span>
			<div class="member-order-refund-box">
				<font class="org font16 bold">¥<{:formatPrice($data['real_price'] + $data['mail_fee'])}></font>
			</div>
		</div>
		<div class="member-order-refund-item">
			<span>退款方式：</span>
			<div class="member-order-refund-box">
				<div class="order-refund-way">
					<p>商家确认后，款项将在7个工作日内退回原支付方</p>
				</div>
			</div>
		</div>
		<div class="member-order-refund-item">
			<span>退款原因：</span>
			<div class="member-order-refund-box">
				<ul class="order-refunnd-radio">
					<li>
						<label>
							<span class="radio-label"><input type="radio" name="refund" class="refund" value="点错商品，点多了" /></span> 点错商品，点多了
						</label>
					</li>
					<li>
						<label>
							<span class="radio-label"><input type="radio" name="refund" class="refund" value="地址电话填写错误" /></span> 地址电话填写错误
						</label>
					</li>
					<li>
						<label>
							<span class="radio-label"><input type="radio" name="refund" class="refund" value="计划有变，不想要了" /></span> 计划有变，不想要了
						</label>
					</li>
					<li>
						<label>
							<span class="radio-label"><input type="radio" name="refund" class="refund" value="商品质量有问题" /></span> 商品质量有问题
						</label>
					</li>
					<li>
						<label>
							<span class="radio-label"><input type="radio" name="refund" class="refund" value="太慢了，等得太久" /></span> 太慢了，等得太久
						</label>
					</li>
					<li>
						<label>
							<span class="radio-label"><input type="radio" name="refund" class="refund" value="其他" /></span> 其他
						</label>
  					</li>
				</ul>
			</div>
		</div>
		<div class="member-order-refund-item">
			<span>补充说明：</span>
			<div class="member-order-refund-box">
				<div class="order-refund-explain">
					<textarea name="" class="order-explain-textarea" placeholder="请输入您要补充说明的内容" id="reasonRemark"></textarea>
				</div>
			</div>
		</div>
		<div class="member-order-refund-item">
			<span></span>
			<div class="member-order-refund-box">
				<button class="refund-btn" type="button">申请退款</button>
			</div>
		</div>
	</div>
</body>
<include file="Public:common-js" />
<script>
$(function() {
	initRadio();
	$(":input[name=refund]").change(function() {
		initRadio();
	})
	function initRadio() {
		var arr = $(":input[name=refund]");
		$(arr).each(function() {
			if($(this).is(":checked")){
				$(this).parents("label").addClass("current");
				$(this).parents(".radio-label").addClass("on");
			}else{
				$(this).parents("label").removeClass("current");
				$(this).parents(".radio-label").removeClass("on");
			}
		})
	}
	
	$(".refund-btn").click(function() {
		if($(":input[name=refund]:checked").val() == undefined) {
			layer.msg("请选择一个退款原因哦~");
			return false;
		}
		$.ajax({
			url: "__ROOT__/Order/applyReturnOrder",
			type:'post',
			data:{'orderCode':$(".order-id").val(),'returnReason':$(".refund:checked").val(),'reasonRemark':$("#reasonRemark").val()},
			success:function(json){
				var result = eval("(" + json + ")");
				if(result.status == 1){
					window.parent.layer.msg(result.info);
				}else{
					window.parent.layer.msg(result.info);
				}
				window.parent.location.reload();
			}
		})
		
	})
})
</script>
</html>
